Skip to main content

Crate gpui_base

Crate gpui_base 

Source
Expand description

Behavior and infrastructure foundations for GPUI applications.

Primitives deliberately avoid presentation styles. Layout, positioning, colors, sizing, and motion belong to applications or the gpui-component façade.

Re-exports§

pub use component_traits::FocusableExt;
pub use component_traits::Disableable;
pub use component_traits::Selectable;
pub use input::Editor;
pub use input::Input;
pub use input::InputBase;
pub use input::InputStyles;
pub use input::Textarea;
pub use motion::Discrete;
pub use motion::DiscreteError;
pub use motion::Easing;
pub use motion::EasingError;
pub use motion::Interpolate;
pub use motion::IterationCount;
pub use motion::Keyframe;
pub use motion::KeyframeError;
pub use motion::Keyframes;
pub use motion::LinearStop;
pub use motion::MotionPhase;
pub use motion::MotionReveal;
pub use motion::MotionStatus;
pub use motion::MotionTransform;
pub use motion::MotionValue;
pub use motion::PlaybackDirection;
pub use motion::Presence;
pub use motion::PresencePhase;
pub use motion::PresenceSample;
pub use motion::SignedDuration;
pub use motion::Spring;
pub use motion::SpringError;
pub use motion::Stagger;
pub use motion::StaggerOrigin;
pub use motion::StepPosition;
pub use motion::Timing;
pub use motion::TimingSample;
pub use motion::Transition;
pub use motion::TransitionId;
pub use motion::animate_keyframes;
pub use motion::spring;
pub use motion::transition;
pub use motion::transition_with_status;
pub use slider::Slider;
pub use slider::SliderIndicator;
pub use slider::SliderThumb;
pub use slider::SliderTrack;
pub use text::MarkdownExtensions;
pub use text::MarkdownNode;
pub use text::MarkdownPlugin;
pub use text::SelectionFormat;
pub use text::TableData;
pub use text::Text;
pub use text::TextView;
pub use text::TextViewDefaults;
pub use text::TextViewPlugin;
pub use text::TextViewState;
pub use text::TextViewStyle;
pub use text::html;
pub use text::markdown;
pub use theme_tokens::ColorTokens;
pub use theme_tokens::RadiusTokens;
pub use theme_tokens::SemanticThemeTokens;
pub use theme_tokens::ShadowTokens;
pub use theme_tokens::SpacingTokens;
pub use theme_tokens::TextStyleToken;
pub use theme_tokens::TypographyTokens;

Modules§

actions
Common actions shared by keyboard-driven GPUI controls.
animation
component_traits
dock
Dockable layout: splits, tab groups, and tiles canvases that a host can rearrange, persist, and restore — with no appearance of its own.
input
Text input: the shared editing engine and the three states built on it.
motion
slider
text
theme_tokens
Semantic design tokens shared by application-owned components.

Structs§

Accordion
An unstyled accordion root for application-owned items.
AccordionHeader
An unstyled heading that owns the trigger for one accordion item.
AccordionItem
An unstyled accordion item connecting one trigger with its panel content.
AccordionPanel
An unstyled accordion panel with controlled mounting.
AccordionTrigger
An unstyled accordion trigger with controlled expanded state.
AlertDialog
Alert-dialog specialization of the Base modal host.
AlertDialogAction
Wrapper that dispatches the alert dialog’s confirm action.
AlertDialogBackdrop
AlertDialogCancel
AlertDialogClose
AlertDialogDescription
AlertDialogPopup
AlertDialogTitle
AlertDialogTrigger
AutoScroll
Manages timer-based auto-scrolling during drag interactions.
Avatar
An unstyled avatar root that renders its image slot or fallback slot.
AvatarFallback
An unstyled avatar fallback slot for initials or an application-owned icon.
AvatarImage
An unstyled avatar image slot.
Button
An unstyled button that owns interaction, focus, keyboard, and accessibility behavior.
ButtonStyles
Semantic styles supported by Button.
Calendar
Complete unstyled calendar structure and behavior.
CalendarItem
An unstyled, pre-wired calendar item passed to the item slot.
CalendarItemState
State exposed to a calendar item slot. Applications may use it solely to decorate the unstyled primitive; all interaction remains owned by base.
CalendarState
Checkbox
An unstyled checkbox that owns toggle, focus, keyboard, and accessibility behavior.
CheckboxIndicator
An unstyled checkbox indicator part with typed checkbox-state projection.
CheckboxIndicatorStyles
Semantic styles supported by CheckboxIndicator.
CheckboxStyles
Semantic styles supported by Checkbox.
Collapsible
An unstyled controlled region whose content can be expanded or collapsed.
ColorPicker
An unstyled controlled color-picker root.
ColorPickerState
State and interaction model for a color picker.
ColorSwatch
An unstyled selectable color in a picker’s palette.
Combobox
An unstyled controlled combobox root.
DatePicker
Unstyled controlled date-picker root. Applications own its trigger, calendar, positioning, and visual presentation; Base owns focus and open/dismiss keyboard behavior.
Decrement
DeferredPopover
Holds the deferred interaction context open for as long as it is alive.
Dialog
Unstyled modal host owning focus, keyboard actions, dismissal, and callback ordering.
DialogBackdrop
Unstyled backdrop part rendered behind a dialog popup.
DialogClose
Wrapper that dispatches the dialog cancel action when activated.
DialogDescription
Unstyled descriptive-content slot for a dialog surface.
DialogHandle
DialogPopup
Unstyled popup part containing dialog content.
DialogTitle
Unstyled title slot for a dialog surface.
DialogTrigger
Unstyled trigger that owns pointer activation for opening a dialog.
Edges
A struct for defining the edges of an element.
GlobalState
Application-wide state shared by Base behaviors.
History
A browser-style linear trail with a current entry.
HoverCard
An unstyled hover-triggered popup with delayed open and close behavior.
HoverCardState
State exposed to a HoverCard::content builder.
HslaSliders
The four component sliders owned by a ColorPickerState.
Increment
IndexPath
Represents an index path in a list, which consists of a section index,
IntervalMatcher
Link
An unstyled link that owns focus, activation, and accessibility semantics.
LinkStyles
Semantic root styles supported by Link.
ListSettings
Global settings for list presentation behavior.
Measure
An elapsed-time measurement emitted through tracing when ended.
NavPage
One mounted view of a NavStack, handed to the item renderer.
NavStack
An unstyled host for a NavStackState.
NavStackState
A stack of views, one visible at a time, with the pages popped off it kept for forward.
NumberInput
An unstyled spinbutton root composed from the foundational InputBase frame.
NumberInputText
The built-in text region of a NumberInput.
OtpInput
Unstyled OTP interaction root. Applications provide the visual cells as children.
OtpState
Stateful input and focus behavior for a fixed-length numeric one-time code.
Pagination
An unstyled pagination navigation landmark.
PaginationState
The controlled behavior shared by every part of a pagination control.
Popover
An unstyled popover owning trigger interaction, open state, dismissal, and focus.
PopoverState
State and focus lifecycle for an unstyled popover.
Popup
An unstyled trigger and anchored popup host.
Positioner
An unstyled element that positions its children as an anchored popup.
Progress
An unstyled linear progress root with controlled value accessibility.
ProgressIndicator
An unstyled progress indicator.
ProgressTrack
An unstyled progress track.
Radio
An unstyled radio control that owns activation, focus, and accessibility behavior.
RadioGroup
An unstyled container for a set of radio elements.
RadioStyles
Semantic root styles supported by Radio.
RangeMatcher
ResizablePanel
A resizable panel inside a ResizablePanelGroup.
ResizablePanelGroup
A group of resizable panels.
ResizableState
State for a ResizablePanel
ResizableTheme
Global visual defaults used by resizable panel handles.
ResizeHandleContext
What a ResizeHandleRenderer is told about the handle it is drawing.
ResolvedPosition
The bounds a popup resolved to, and the side it ended up on.
ScrollableMask
Make a scrollable mask element to cover the parent view with the mouse wheel event listening.
Scrollbar
Scrollbar control for scroll-area or a uniform-list.
ScrollbarMotion
Motion tokens used by Scrollbar.
ScrollbarStyles
Typed paint styles supported by Scrollbar.
ScrollbarTheme
Global defaults used by crate::Scrollbar.
ScrollbarThumbStyle
Paint-only styles for a scrollbar thumb.
ScrollbarTrackStyle
Paint-only styles for a scrollbar track.
Select
An unstyled controlled select root.
SelectableText
Plain text that participates in the window-scoped TextSelection.
Sheet
An unstyled modal sheet host.
StateStyle
A semantic-state style builder.
Switch
An unstyled binary control that owns switch interaction and semantics.
SwitchStyles
Semantic root styles supported by Switch.
SwitchThumb
An unstyled switch thumb with typed checked and disabled state projection.
SwitchThumbStyles
Semantic styles supported by SwitchThumb.
SwitchTrack
An unstyled switch track with typed checked and disabled state projection.
SwitchTrackStyles
Semantic styles supported by SwitchTrack.
Tab
An unstyled tab that owns pointer activation and accessibility behavior.
TabStyles
Table
An unstyled semantic table root.
TableBody
An unstyled table body group.
TableCaption
An unstyled table caption slot.
TableCell
An unstyled table data cell.
TableHead
An unstyled table column header.
TableHeader
An unstyled table header group.
TableRow
An unstyled semantic table row.
Tabs
An unstyled collection root for Tab elements.
TextSelection
Window-level operations for text selection.
TextSelectionContentKey
Stable participant-defined identity for virtualized participant content.
TextSelectionEndpoint
A selection endpoint anchored to a participant’s content coordinates.
TextSelectionHandle
A stable, participant-neutral handle for text that participates in window selection.
TextSelectionLayer
A zero-sized root layer which enables text selection for a window.
TextSelectionProjection
Selection projected onto a participant’s laid-out text runs.
TextSelectionRegistration
Per-frame geometry reported by a TextSelectionHandle participant.
TextSelectionRun
Laid-out text reported by a plain selection participant during paint.
TextSelectionScopeId
An opaque selection layer identifier.
TextSelectionSnapshot
Participant-relative selection endpoints with an optional rendering projection.
TextSelectionWindowPoints
Window-coordinate anchor and cursor points for painting a selection.
Theme
Toast
An unstyled semantic toast root. Applications own all presentation and motion.
ToastAdvance
Changes produced when a toast manager advances its lifecycle clock.
ToastManager
Ordered toast storage, lifecycle, auto-hide, limits, and exit coordination.
ToastMotion
Motion tokens used by an unstyled toast stack.
ToastOptions
Options applied when a toast enters a ToastManager.
ToastStack
A deep toast-stack element that owns measurement, overlap, and expansion motion.
ToastStackState
Persistent private layout state used by ToastStack.
Toggle
An unstyled, controlled toggle button.
ToggleGroup
An unstyled container for a set of toggle elements.
ToggleStyles
Semantic root styles supported by Toggle.
Tooltip
An unstyled tooltip popup.
TooltipOverlay
Per-window tooltip provider and overlay.
TooltipPositioner
An unstyled tooltip positioner with viewport-aware flipping and clamping.
TooltipRequest
Content requested by a tooltip trigger.
Tree
An unstyled, virtualized tree element.
TreeEntry
A flat representation of a tree item with its depth.
TreeEntryState
The interaction state supplied while rendering a visible tree entry.
TreeItem
A tree item with a stable id, display label, children, and shared state.
TreeState
Behavior and interaction state for a virtualized tree.
UndoHistory
A history of grouped undo transactions.
VirtualList
VirtualList component for rendering a large number of differently sized items.
VirtualListScrollHandle
A scroll handle for VirtualList.

Enums§

Align
Alignment of a popup along the side it is placed on.
CalendarEvent
CalendarItemKind
The semantic kind of a calendar control rendered by Calendar.
CalendarView
CheckboxState
The semantic value exposed by an unstyled Checkbox.
ColorPickerEvent
Events emitted by a ColorPickerState.
Date
A controlled calendar value.
DialogChangeReason
Matcher
NavMotion
Whether one change runs the NavStack’s transition, as UIKit’s animated: and Qt’s StackView.Immediate decide per call.
NavOperation
What a running transition is doing, in Qt’s terms.
NavStackEvent
Emitted by NavStackState after the stack changed.
NumberInputEvent
NumberStep
Strategy used by numeric editors when stepping their value.
OtpEvent
A semantic notification from a one-time-code state.
PaginationItem
A visible destination in a pagination control.
Placement
A enum for defining the placement of the element.
ResizablePanelEvent
RoleOverride
ScrollbarAxis
Scrollbar axis.
ScrollbarEntrance
How a scrollbar becomes visible.
ScrollbarMode
Scrollbar show mode.
Side
A enum for defining the side of the element.
StepAction
TextSelectionCoverage
How much of one participant participates in a window selection.
TextSelectionEvent
Notifications emitted by a text-selection participant.
ThemeAppearance
Application-wide defaults for Base behavior modules.
ToastTransitionStatus
The lifecycle phase exposed by a toast root to application-owned presentation.
TooltipTransition
Presentation transition requested by the Base tooltip lifecycle.
TreeEvent
Event emitted by a tree when user-visible expansion state changes.

Constants§

POPUP_PRIORITY
Deferred paint priority for interactive surfaces that must appear above dialogs.

Traits§

AxisExt
A trait to extend the Axis enum with utility methods.
ElementExt
Extends a GPUI parent element with post-layout prepaint observation.
FocusTrapElement
An extension trait to add focus_trap functionality to interactive elements.
InteractiveElementExt
LengthExt
A trait to extend the Length enum with utility methods.
OngoingScrollExt
gpui delimits scroll gestures with std::time::Instant, which is unimplemented on wasm32: the first wheel event over an axis-locked scroll area panics with “time not implemented on this platform” and takes the whole application down, leaving the canvas unresponsive. Losing the axis lock in the browser is by far the lesser cost, so the locks below are no-ops there.
ScrollbarHandle
A trait for scroll handles that can get and set offset.
StyledExt

Functions§

box_shadow
h_flex
A row that centers its children on the cross axis.
h_resizable
Create a ResizablePanelGroup with horizontal resizing
h_virtual_list
Create a VirtualList in horizontal direction.
init
Initializes global infrastructure owned by the base layer.
measure
Measures f when measurement logging is enabled.
measure_if
Measures f when if_ is true and measurement logging is enabled.
resizable_panel
Create a ResizablePanel.
step_value
Step a numeric string while preserving decimal precision and range direction.
styled_ext_reflection_methods
v_flex
A column whose children stretch across the cross axis.
v_resizable
Create a ResizablePanelGroup with vertical resizing
v_virtual_list
Create a VirtualList in vertical direction.

Type Aliases§

ResizeHandleRenderer
Draws the visible part of a resize handle.